package reflect;

import java.lang.reflect.Method;

public class ReflectDemo5 {
    public static void main(String[] args)throws Exception {
        //p.say(String);
        Class cls = Class.forName("reflect.Person");
        Object o = cls.newInstance();//new Person()

        Method method = cls.getMethod("say", String.class);
        method.invoke(o,"大家好!");// o.say("大家好!");

        //o.say("嘿嘿",5);
        Method method2 = cls.getMethod("say", String.class, int.class);
        method2.invoke(o,"嘿嘿",5);


    }
}
